<template>
  <el-dialog title="查看" :close-on-click-modal="false" :visible.sync="visible" class="view" center>
    <div>
      <p>
        <span>伴读对象名称</span>:
        <span>{{partnerName}}</span>
      </p>
      <p>
        <span>心愿名称</span>:
        <span>{{title}}</span>
      </p>
      <p>
        <span>心愿缩略图</span>:
        <span>
          <img :src="wishInfo" style="width: 40px; height: 40px;vertical-align: middle;">
        </span>
      </p>
      <p>
        <span>心愿状态</span>:
        <span v-if="wishStatus==1">进行中</span>
        <span v-if="wishStatus==2">帮助中</span>
        <span v-if="wishStatus==3">已完成</span>
        <span v-if="wishStatus==4">暂停状态</span>
        <span v-if="wishStatus==0">新建状态</span>
      </p>
      <p>
        <span>心愿描述</span>:
        <span>{{detail}}</span>
      </p>
      <p>
        <span>所需学分</span>:
        <span>{{targetCredit}}</span>
      </p>
      <p>
        <span>申请理由</span>:
        <span>
          <img :src="whyUrl" style="width: 40px; height: 40px;vertical-align: middle;">
        </span>
      </p>
      <p>
        <span>支教老师</span>:
        <span>{{teacherName}}</span>
      </p>
      <p>
        <span>状态</span>:
        <span v-if="isAlive==1">显示</span>
        <span v-else>不显示</span>
      </p>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false" style="text-align:center">返回</el-button>
    </span>
  </el-dialog>
</template>
<style>
.inline {
  display: inline;
}
.types div {
  display: inline;
}
</style>

<script>
export default {
  data() {
    return {
      visible: false,
      detail: "",
      isAlive: "",
      partnerName: "",
      targetCredit: "",
      teacherName: "",
      teacherWhy: "",
      title: "",
      whyUrl: "",
      wishStatus: "",
      wishInfo: ""
    };
  },
  methods: {
    init(id) {
      this.id = id || 0;
      this.visible = true;
      this.$nextTick(() => {
        // this.$refs["dataForm"].resetFields();
        // if (this.dataForm.id) {
        this.$http({
          url: this.$http.adornUrl(`/partner/partnerwish/see/${this.id}`),
          method: "get",
          params: this.$http.adornParams()
        }).then(({ data }) => {
          if (data && data.code === 0) {
            (this.detail = data.partnerWish.detail),
              (this.isAlive = data.partnerWish.isAlive),
              (this.partnerName = data.partnerWish.partnerName);
            (this.targetCredit = data.partnerWish.targetCredit),
              (this.teacherName = data.partnerWish.teacherName),
              (this.teacherWhy = data.partnerWish.teacherWhy),
              (this.title = data.partnerWish.title),
              (this.whyUrl = data.partnerWish.whyUrl),
              (this.wishStatus = data.partnerWish.wishStatus),
              (this.wishInfo = data.partnerWish.wishInfo);
          }
        });
        // }
      });
    }
  }
};
</script>
